#ubuntu通过danted搭建socks5代理
#服务端配置转自：https://blog.csdn.net/qq_29663071/article/details/53337975

#客户端使用proxifier_3.21

##1.安装dante-server

apt-get install dante-server

#2.修改配置文件：
#备份原配置文件
mv /etc/danted.conf /etc/danted.conf.bak

#新建配置文件
touch /etc/danted.conf
#nano /etc/danted.conf

#匿名配置内容
echo logoutput: /var/log/danted.log > /etc/danted.conf
echo internal: 127.0.0.1 port = 61080 >> /etc/danted.conf
echo external: 127.0.0.1 >> /etc/danted.conf
echo method: username none >> /etc/danted.conf
echo user.privileged: proxy >> /etc/danted.conf
echo user.notprivileged: nobody >> /etc/danted.conf
echo user.libwrap: nobody >> /etc/danted.conf
echo client pass { >> /etc/danted.conf
echo from: 0.0.0.0/0 to: 0.0.0.0/0 >> /etc/danted.conf
echo log: connect disconnect >> /etc/danted.conf
echo } >> /etc/danted.conf
echo pass { >> /etc/danted.conf
echo from: 0.0.0.0/0 to: 0.0.0.0/0 port gt 1023 >> /etc/danted.conf
echo command: bind >> /etc/danted.conf
echo log: connect disconnect >> /etc/danted.conf
echo } >> /etc/danted.conf
echo pass { >> /etc/danted.conf
echo from: 0.0.0.0/0 to: 0.0.0.0/0 >> /etc/danted.conf
echo command: connect udpassociate >> /etc/danted.conf
echo log: connect disconnect >> /etc/danted.conf
echo } >> /etc/danted.conf
echo block { >> /etc/danted.conf
echo from: 0.0.0.0/0 to: 0.0.0.0/0 >> /etc/danted.conf
echo log: connect error >> /etc/danted.conf
echo } >> /etc/danted.conf

#3.创建log文件夹
mkdir /var/log/sockd

#4.启动Dante
/etc/init.d/danted start
#02.png 

#5.检测是否启动成功
netstat -anp | grep 61080




#开启用户身份验证

sudo nano /etc/danted.conf

logoutput: /var/log/danted.log
internal: 192.168.237.25 port = 8001
external: 192.168.237.25
method: username  #none
user.privileged: root
user.notprivileged: 用户名(注意前面的空格。。。。)
user.libwrap: nobody
client pass {
from: 0.0.0.0/0 to: 0.0.0.0/0
log: connect disconnect
}
pass {
        from: 0.0.0.0/0 to: 0.0.0.0/0
        command: bind connect udpassociate
        log: error # connect disconnect iooperation
        method: username
}
block {
from: 0.0.0.0/0 to: 0.0.0.0/0
log: connect error

}

#可以使用useradd指令添加一个用户 如danted

#然后设置密码passwd danted